package com.pxml2pdf.pdf.Node;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import com.itextpdf.text.BadElementException;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.Image;
import com.itextpdf.text.pdf.PdfContentByte;

public class RadioNode extends BaseNode{
	
	private static final String RADIO="rb";

	@Override
	public void drawingBox(PdfContentByte cb) {
		
	}

	@Override
	public void fillValue(PdfContentByte cb,  Font font) throws DocumentException {
		//super.fillValue(cb, ni, font);
		
		URL filename = getIcons(RADIO,isChecked(),isDisabled());
		
		float hei = getHeight() * getScale();
		try {
			Image image = Image.getInstance(filename);
			image.setAbsolutePosition(getLlx(), getLly()+getExpansionYByFont());
			image.setAlignment(Image.UNDERLYING);
			image.scaleAbsolute(hei,hei);
			cb.addImage(image);
		} catch (BadElementException e) {
			e.printStackTrace();
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} catch (DocumentException e) {
			e.printStackTrace();
		}
	}
	
	

}
